package com.xsd.composite;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description:
 * @Author: zhoufuzong
 * @Created: 2021-02-25 22:21:41
 * @Version: 1.1.0
 */

public class University extends OrganizationComponent {

    // list 中 存放 college
    List<OrganizationComponent> organizationComponents = new ArrayList<>();


    public University(String name, String des) {
        super(name, des);
    }

    @Override
    protected void add(OrganizationComponent organizationComponent) {
        organizationComponents.add(organizationComponent);
    }

    @Override
    protected void remove(OrganizationComponent organizationComponent) {
        organizationComponents.remove(organizationComponent);
    }

    @Override
    public String getName() {
        return super.getName();
    }

    @Override
    public String getDes() {
        return super.getDes();
    }

    // 输出 University 包含的学院
    @Override
    protected void print() {
        System.out.println("*********"+getName()+"*********");
        for (OrganizationComponent organizationComponent : organizationComponents) {
            organizationComponent.print();
        }
    }
}
